package com.avcdata.aoscustommade.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by c.c on 2017/3/2.
 * Tab页面适配器
 */

public class TabAdapter extends FragmentPagerAdapter {

    private ArrayList<Fragment> fragments;
    private ArrayList<String> tabString;

    public TabAdapter(FragmentManager fm, ArrayList<Fragment> fragments, ArrayList<String> tabString) {
        super(fm);
        this.fragments = fragments;
        this.tabString = tabString;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabString.get(position);
    }

    @Override
    public int getCount() {
        return tabString.size();
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }


}
